import java.io.DataOutputStream;
import java.io.IOException;

/**
 * Created by zdl on 2019/4/10
 */
public class ExecuteHeartThread implements Runnable {
    DataOutputStream out;
    String imei;
    private static volatile int heartCount = 0;

    public ExecuteHeartThread(DataOutputStream out, String imei) {
        this.out = out;
        this.imei = imei;
    }

    @Override
    public void run() {
        //String sendJsonss = "[YW*" + imei + "*0001*0002*LK,20%]";

        try {
            while (true) {
                String sendJsonss ="*WT,"+imei+",KA,HHMMSS,gsm,gps,80,MCC,MNC,TA,NUM,LAC,CELLID,RXLEV,DDMMYY,FFDFFFFF# ";
                byte[] outByte2 = sendJsonss.getBytes("utf-8");
                out.write(outByte2);
                out.flush();
                Thread.sleep( 60 * 1000);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

    public static void main(String[] args) {
        long a =System.currentTimeMillis();
        System.out.println(a);
        System.out.println(a/1000);
        System.out.println(((a/1000)+"").substring(6));
    }
}
